package com.crecheng.shop.Manage;

import com.crecheng.shop.DAO.ItemData;
import com.crecheng.shop.DAO.UserData;
import com.crecheng.shop.DAO.UserData;
import com.crecheng.shop.util.ConSQL;
import com.crecheng.shop.util.ListUtil;

import java.util.List;

public final class UserManage {
    public static List<UserData> getAll(){
        return ConSQL.select(UserData.class);
    }

    public static List<UserData> get(String other){
        return ConSQL.select(UserData.class,other);
    }

    public static UserData get(int id){
        return ListUtil.first(get("id="+id));
    }
    public static UserData getByName(String userName){
        return ListUtil.first(get("userName="+"\""+userName+"\""));
    }

    public static List<UserData> getByUid(int uid){
        return get("uid="+uid);
    }
    public static boolean add(UserData d){
        return ConSQL.insert(UserData.class,d)>0;
    }

}
